<?php 


/** 
***************************************************
*欢迎使用免费版xSite企业自助建站软件！
*这是一个专业为搜索引擎营销而设计的，极稳定、极易维护的建站软件！
*官方客服：help@php.net.cn
*官方下载网址：http://www.php.net.cn/xsite/ 
***************************************************
**/




 @set_time_limit(0); header("Cache-Control: no-cache, must-revalidate"); header("Content-type: text/html;charset=UTF-8"); if ($_SERVER['SERVER_PORT'] != 80 || !isset($_SERVER['HTTP_HOST'])) { echo "本软件只能运行在HTTP80端口模式下！"; exit(); } if (!ini_get('short_open_tag')) { echo "你的PHP.INI文件需要启用“short_open_tag”选项才能运行本软件"; exit(); } define('UPDATE_ROOT', str_replace('\\', '/', dirname(__FILE__))); $step = strip_tags(empty($_GET['step']) ? empty($_POST['step']) ? 'InstallFrame' : $_POST['step'] : $_GET['step']); if (file_exists("./install.ok")) { exit("你已经成功安装了该软件，如果需要重新安装，请删除网站根目录下的“./install.ok”文件"); } $chmod_setting = array("index", "xsite", "setup", "tool", "update"); if (!@rename('php.net.cn/xsite/data/version.txt', 'php.net.cn/xsite/data/version.txt')) { echo '<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /></head><body style="font-size:13px">网站无法安装，请务必将网站根目中的以下文件设有“可读、可执行”的属性：'; foreach ($chmod_setting as $k => $v) { echo "./{$v}.php<br />"; } echo '</body></html>'; exit(); } require_once UPDATE_ROOT . "/php.net.cn/install/install.lib.php"; if ($step == 'InstallFrame') { include UPDATE_ROOT . "/php.net.cn/install/tpl/installframe.html.php"; exit(); } if ($step == 'php_environment') { $server_info['PHP_ENVIRONMENT'] = 1; $os = @explode(" ", php_uname()); $server_info['SERVER_OS'] = @$os[0]; $server_info['SERVER_SOFTWARE'] = @$_SERVER['SERVER_SOFTWARE']; $server_info['PHP_VERSION'] = PHP_VERSION; if (PHP_VERSION < '4.3.0') { $server_info['PHP_ENVIRONMENT'] = 0; } echo array_to_json($server_info); } if ($step == 'chmod') { $json['PHP_CHMOD'] = 1; $json['chmod']['./php.net.cn/xsite/include/domain.php'] = 0; $json['chmod']['./attachments'] = 0; $json['chmod']['./php.net.cn/xsite/data'] = 0; $json['chmod']['./php.net.cn/xsite/data/setting'] = 0; $json['chmod']['./php.net.cn/xsite/data/cache'] = 0; $json['chmod']['./php.net.cn/xsite/data/log'] = 0; $json['chmod']['./php.net.cn/xsite/data/tpl'] = 0; $json['chmod']['./php.net.cn/xsite/data/version.txt'] = 0; foreach ($json['chmod'] as $k => $v) { if (is_dir($k)) { if ($dh = @opendir($k)) { $json['chmod'][$k] = 1; closedir($dh); } else { $json['chmod'][$k] = 0; $json['PHP_CHMOD'] = 0; } } else { if ($fp = @fopen($k, "a+")) { $json['chmod'][$k] = 1; fclose($fp); } else { $json['chmod'][$k] = 0; $json['PHP_CHMOD'] = 0; } } } echo array_to_json($json); } if ($step == 'config') { if (isset($_POST['domain']) && isset($_POST['site_id'])) { $config['domain'] = strip_tags($_POST['domain']); $config['site_title'] = strip_tags($_POST['site_title']); $config['site_description'] = strip_tags($_POST['site_description']); $config['site_keywords'] = strip_tags($_POST['site_keywords']); $config['site_id'] = strip_tags($_POST['site_id']); $config['skinid'] = strip_tags($_POST['skinid']); $config['admin'] = strip_tags($_POST['admin']); $config['password'] = strip_tags($_POST['password']); $config['db_host'] = strip_tags(rawurldecode($_POST['site_db_host'])); $config['db_user'] = strip_tags(rawurldecode($_POST['site_db_user'])); $config['db_password'] = rawurldecode($_POST['site_db_password']); $config['db_name'] = strip_tags(rawurldecode($_POST['site_db_name'])); $config['SITE_PATH'] = strip_tags($_POST['site_path']); $config['INSTALL_STATUS'] = '1'; $config['site_id'] = str_replace('-', '_', $config['site_id']); $config_code = file_get_contents(UPDATE_ROOT . "/php.net.cn/install/config.php"); foreach ($config as $k => $v) { $config_code = str_replace("[config]{$k}[/config]", $v, $config_code); } if ($fp = fopen("php.net.cn/xsite/include/domain.php", "w")) { fwrite($fp, $config_code); fclose($fp); require_once UPDATE_ROOT . "/php.net.cn/xsite/include/global.inc.php"; $site_id = $config['site_id']; if ($link = @mysql_connect($config['db_host'], $config['db_user'], $config['db_password'])) { if (@mysql_select_db($config['db_name'], $link)) { } else { exit('2'); } @mysql_close($link); exit('1'); } else { exit('2'); } } else { exit('3'); } } else { define('SITE_ROOT', UPDATE_ROOT . "/php.net.cn/xsite"); define('SITE_DIR', dirname(dirname(SITE_ROOT))); define("IN_SITETEAM", true); require_once UPDATE_ROOT . "/php.net.cn/xsite/include/template.inc.php"; require_once SITE_ROOT . "/include/global.inc.php"; require_once SITE_ROOT . "/admin/admin.inc.php"; $theme = theme_cache(); include UPDATE_ROOT . "/php.net.cn/install/tpl/config.html.php"; } } if ($step == 'report') { require_once UPDATE_ROOT . "/php.net.cn/xsite/include/global.inc.php"; $data['website'] = strip_tags(empty($_GET['website']) ? empty($_POST['website']) ? '' : $_POST['website'] : $_GET['website']); $data['admin'] = strip_tags(empty($_GET['admin']) ? empty($_POST['admin']) ? '' : $_POST['admin'] : $_GET['admin']); $data['email'] = strip_tags(empty($_GET['email']) ? empty($_POST['email']) ? '' : $_POST['email'] : $_GET['email']); $json = array(); if (preg_match('/[\w\.\-]+/is', $data['website']) && !empty($data['admin']) && preg_match('/^[\w\.\-_]+@[\w\.\-_]+\.[\w]+/is', $data['email'])) { $json['status'] = @post_data(base64_decode('aHR0cDovL2RhdGEucGhwLm5ldC5jbi94c2l0ZS9yZXBvcnQucGhwP2FjdGlvbj1uZXdfaW5zdGFsbA=='), $data ); } else { $json['status'] = '0'; } echo array_to_json($json); } if ($step == 'write_data') { $web_host = strip_tags(empty($_GET['web_host']) ? empty($_POST['web_host']) ? $_SERVER['HTTP_HOST'] : $_POST['web_host'] : $_GET['web_host']); $site_id = strip_tags(empty($_GET['site_id']) ? empty($_POST['site_id']) ? substr(md5(preg_replace("/[\.]+/", '', $_SERVER['HTTP_HOST'])), 0, 8) : $_POST['site_id'] : $_GET['site_id']); $json['title'] = '开始写入...'; @move_dir(UPDATE_ROOT . "/php.net.cn/demo/xsite", UPDATE_ROOT . "/attachments/{$site_id}"); $json['file'][] = "\nOK:/attachments/{$site_id}"; @move_dir(UPDATE_ROOT . "/php.net.cn/demo/demo.php.net.cn", UPDATE_ROOT . "/php.net.cn/xsite/data/setting/{$web_host}"); $json['file'][] = "\nOK:/data/setting/{$web_host}"; @file_replace(UPDATE_ROOT . "/php.net.cn/xsite/data/setting/{$web_host}", "attachments/xsite/", "attachments/{$site_id}/"); require_once UPDATE_ROOT . "/php.net.cn/xsite/include/common.inc.php"; require_once UPDATE_ROOT . "/php.net.cn/xsite/admin/admin.inc.php"; if (check_db_structure($site_id)) { cache_update("setting"); $user_data_dir = SITE_ROOT . "/data/setting/{$site_url}"; update_index(); } echo array_to_json($json); } if ($step == 'check_mysql_link') { $json = array(); $host = empty($_GET['host']) ? empty($_POST['host']) ? '' : $_POST['host'] : $_GET['host']; $password = empty($_GET['password']) ? empty($_POST['password']) ? '' : $_POST['password'] : $_GET['password']; $user = empty($_GET['user']) ? empty($_POST['user']) ? '' : $_POST['user'] : $_GET['user']; $dbname = empty($_GET['dbname']) ? empty($_POST['dbname']) ? '' : $_POST['dbname'] : $_GET['dbname']; if ($link = @mysql_connect($host, $user, $password)) { if (@mysql_select_db($dbname, $link)) { $json['db_link'] = 1; } else { $json['db_link'] = 0; } @mysql_close($link); } else { $json['db_link'] = 0; } echo array_to_json($json); } if ($step == 'copyright') { echo file_get_contents(UPDATE_ROOT . "/php.net.cn/install/tpl/copyright.html.php"); } if ($step == 'success') { echo '{"install_status":"1"}'; } if ($step == 'lock') { $fp = fopen("./install.ok", "w"); fclose($fp); } ?>
